﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace MedicalSystem.SamrtReport.Library
{
   public static  class Logger
    {
       private static object _object = new object();
       
       public static void Write(string message)
       {
           if (!System.IO.Directory.Exists(string.Format(@"{0}\Log", Application.StartupPath)))
               System.IO.Directory.CreateDirectory(string.Format(@"{0}\Log", Application.StartupPath));
           try
           {
               lock (_object)
               {
                  
                   System.IO.File.AppendAllText(string.Format(@"{0}\Log\{1}.txt", Application.StartupPath,
                              DateTime.Today.ToString("yyyyMMdd")), message + Environment.NewLine, Encoding.Default);
               }
               
              
           }
           catch (Exception e)
           {

               MessageBox.Show(e.Message, "提示框", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }

        
       }
       
    }
}
